package com.hsgene.common;

/**
 * @description: 范围类型
 * @projectName: hdas-geneshop-server
 * @package: com.hsgene.common
 * @author: maodi
 * @createDate: 2018/10/23 19:09
 * @version: 1.0
 * Copyright: Copyright (c) 2018
 */
public enum  RangeType {
    /**
     * 全部
     */
    ALL(1,"all","全部"),
    /**
     * 部分
     */
    PART(2,"part","部分");

    private final int code;

    private final String message;

    private final String description;

    RangeType(int code, String message, String description) {
        this.code = code;
        this.message = message;
        this.description = description;
    }

    public static RangeType getEnum(int code) {
        for (RangeType errorCode : values()) {
            if (errorCode.code == code) {
                return errorCode;
            }
        }
        throw new IllegalArgumentException("No element matches " + code);
    }

    public int getCode() {
        return code;
    }

    public String getMessage() {
        return message;
    }

    public String getDescription() {
        return description;
    }
}
